package com.lesama.map;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class MapTest2 {
    public static void main(String[] args) {
        Map<String, List<String>> provCities = new HashMap<>();

        List<String> list1 = new ArrayList<>();
        Collections.addAll(list1, "南昌市", "赣州市", "鹰潭市");
        List<String> list2 = new ArrayList<>();
        Collections.addAll(list2, "广州市", "深圳市", "江门市");
        List<String> list3 = new ArrayList<>();
        Collections.addAll(list3, "郴州市", "长沙市");

        provCities.put("江西省", list1);
        provCities.put("广东省", list2);
        provCities.put("湖南省", list3);

        Set<Map.Entry<String, List<String>>> entries = provCities.entrySet();
        for (Map.Entry<String, List<String>> entry : entries) {
            System.out.print(entry.getKey() + "=");
            List<String> list = entry.getValue();
            for (int i = 0; i < list.size() - 1; i++) {
                System.out.print(list.get(i) + "+");
            }
            System.out.println(list.get(list.size() - 1));
        }
    }
}
